.class public Lcom/philzhu/www/framework/impl/RButton;
.super Ljava/lang/Object;
.source "RButton.java"


# static fields
.field public static final BUTTON_CALL:I = 0x8

.field public static final BUTTON_EXIT:I = 0x9

.field public static final BUTTON_FOLD:I = 0x1

.field public static final BUTTON_GET_POINTS:I = 0xc

.field public static final BUTTON_KEEPER:I = 0xb

.field public static final BUTTON_MUSIC_OFF:I = 0xe

.field public static final BUTTON_MUSIC_ON:I = 0xd

.field public static final BUTTON_NEXT:I = 0xa

.field public static final BUTTON_ONE:I = 0x2

.field public static final BUTTON_PASS:I = 0x5

.field public static final BUTTON_RECHOOSE:I = 0x6

.field public static final BUTTON_THREE:I = 0x4

.field public static final BUTTON_TIP:I = 0x7

.field public static final BUTTON_TWO:I = 0x3


# instance fields
.field private btnActionListener:Lcom/philzhu/www/framework/ButtonActionListener;

.field private btnImgs:[Lcom/philzhu/www/framework/Pixmap;

.field public btnKind:I

.field private g:Lcom/philzhu/www/framework/Graphics;

.field private isPressed:Z

.field public isVisible:Z

.field private strImgs:Lcom/philzhu/www/framework/Pixmap;

.field private triggerAfterDown:Z

.field private x:I

.field private y:I


# direct methods
.method public constructor <init>(Lcom/philzhu/www/framework/Graphics;[Lcom/philzhu/www/framework/Pixmap;Lcom/philzhu/www/framework/ButtonActionListener;IIIZ)V
    .locals 3
    .parameter "g"
    .parameter "b"
    .parameter "listener"
    .parameter "btnKind"
    .parameter "x"
    .parameter "y"
    .parameter "triggerAfterDown"

    .prologue
    const/4 v2, 0x0

    const/4 v1, 0x0

    .line 50
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 30
    iput-boolean v1, p0, Lcom/philzhu/www/framework/impl/RButton;->isVisible:Z

    .line 32
    const/4 v0, 0x2

    new-array v0, v0, [Lcom/philzhu/www/framework/Pixmap;

    iput-object v0, p0, Lcom/philzhu/www/framework/impl/RButton;->btnImgs:[Lcom/philzhu/www/framework/Pixmap;

    .line 33
    iput-object v2, p0, Lcom/philzhu/www/framework/impl/RButton;->strImgs:Lcom/philzhu/www/framework/Pixmap;

    .line 34
    iput-boolean v1, p0, Lcom/philzhu/www/framework/impl/RButton;->isPressed:Z

    .line 35
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/philzhu/www/framework/impl/RButton;->triggerAfterDown:Z

    .line 36
    iput-object v2, p0, Lcom/philzhu/www/framework/impl/RButton;->btnActionListener:Lcom/philzhu/www/framework/ButtonActionListener;

    .line 52
    iput-object p1, p0, Lcom/philzhu/www/framework/impl/RButton;->g:Lcom/philzhu/www/framework/Graphics;

    .line 53
    iput-object p2, p0, Lcom/philzhu/www/framework/impl/RButton;->btnImgs:[Lcom/philzhu/www/framework/Pixmap;

    .line 54
    iput-object p3, p0, Lcom/philzhu/www/framework/impl/RButton;->btnActionListener:Lcom/philzhu/www/framework/ButtonActionListener;

    .line 55
    iput p4, p0, Lcom/philzhu/www/framework/impl/RButton;->btnKind:I

    .line 56
    iput p5, p0, Lcom/philzhu/www/framework/impl/RButton;->x:I

    .line 57
    iput p6, p0, Lcom/philzhu/www/framework/impl/RButton;->y:I

    .line 58
    iput-boolean p7, p0, Lcom/philzhu/www/framework/impl/RButton;->triggerAfterDown:Z

    .line 59
    return-void
.end method

.method public constructor <init>(Lcom/philzhu/www/framework/Graphics;[Lcom/philzhu/www/framework/Pixmap;Lcom/philzhu/www/framework/Pixmap;Lcom/philzhu/www/framework/ButtonActionListener;IIIZ)V
    .locals 3
    .parameter "g"
    .parameter "b"
    .parameter "s"
    .parameter "listener"
    .parameter "btnKind"
    .parameter "x"
    .parameter "y"
    .parameter "triggerAfterDown"

    .prologue
    const/4 v2, 0x0

    const/4 v1, 0x0

    .line 38
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 30
    iput-boolean v1, p0, Lcom/philzhu/www/framework/impl/RButton;->isVisible:Z

    .line 32
    const/4 v0, 0x2

    new-array v0, v0, [Lcom/philzhu/www/framework/Pixmap;

    iput-object v0, p0, Lcom/philzhu/www/framework/impl/RButton;->btnImgs:[Lcom/philzhu/www/framework/Pixmap;

    .line 33
    iput-object v2, p0, Lcom/philzhu/www/framework/impl/RButton;->strImgs:Lcom/philzhu/www/framework/Pixmap;

    .line 34
    iput-boolean v1, p0, Lcom/philzhu/www/framework/impl/RButton;->isPressed:Z

    .line 35
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/philzhu/www/framework/impl/RButton;->triggerAfterDown:Z

    .line 36
    iput-object v2, p0, Lcom/philzhu/www/framework/impl/RButton;->btnActionListener:Lcom/philzhu/www/framework/ButtonActionListener;

    .line 40
    iput-object p1, p0, Lcom/philzhu/www/framework/impl/RButton;->g:Lcom/philzhu/www/framework/Graphics;

    .line 41
    iput-object p2, p0, Lcom/philzhu/www/framework/impl/RButton;->btnImgs:[Lcom/philzhu/www/framework/Pixmap;

    .line 42
    iput-object p3, p0, Lcom/philzhu/www/framework/impl/RButton;->strImgs:Lcom/philzhu/www/framework/Pixmap;

    .line 43
    iput-object p4, p0, Lcom/philzhu/www/framework/impl/RButton;->btnActionListener:Lcom/philzhu/www/framework/ButtonActionListener;

    .line 44
    iput p5, p0, Lcom/philzhu/www/framework/impl/RButton;->btnKind:I

    .line 45
    iput p6, p0, Lcom/philzhu/www/framework/impl/RButton;->x:I

    .line 46
    iput p7, p0, Lcom/philzhu/www/framework/impl/RButton;->y:I

    .line 47
    iput-boolean p8, p0, Lcom/philzhu/www/framework/impl/RButton;->triggerAfterDown:Z

    .line 48
    return-void
.end method

.method private inBounds(Lcom/philzhu/www/framework/Input$TouchEvent;)Z
    .locals 7
    .parameter "event"

    .prologue
    const/4 v6, 0x0

    const/4 v5, 0x1

    .line 159
    iget-object v3, p0, Lcom/philzhu/www/framework/impl/RButton;->btnImgs:[Lcom/philzhu/www/framework/Pixmap;

    aget-object v3, v3, v6

    if-nez v3, :cond_0

    iget-object v3, p0, Lcom/philzhu/www/framework/impl/RButton;->btnImgs:[Lcom/philzhu/www/framework/Pixmap;

    aget-object v3, v3, v5

    move-object v1, v3

    .line 160
    .local v1, img:Lcom/philzhu/www/framework/Pixmap;
    :goto_0
    invoke-interface {v1}, Lcom/philzhu/www/framework/Pixmap;->getRawWidth()I

    move-result v2

    .line 161
    .local v2, width:I
    invoke-interface {v1}, Lcom/philzhu/www/framework/Pixmap;->getRawHeight()I

    move-result v0

    .line 162
    .local v0, height:I
    iget v3, p1, Lcom/philzhu/www/framework/Input$TouchEvent;->x:I

    iget v4, p0, Lcom/philzhu/www/framework/impl/RButton;->x:I

    if-le v3, v4, :cond_1

    iget v3, p1, Lcom/philzhu/www/framework/Input$TouchEvent;->x:I

    iget v4, p0, Lcom/philzhu/www/framework/impl/RButton;->x:I

    add-int/2addr v4, v2

    sub-int/2addr v4, v5

    if-ge v3, v4, :cond_1

    .line 163
    iget v3, p1, Lcom/philzhu/www/framework/Input$TouchEvent;->y:I

    iget v4, p0, Lcom/philzhu/www/framework/impl/RButton;->y:I

    if-le v3, v4, :cond_1

    iget v3, p1, Lcom/philzhu/www/framework/Input$TouchEvent;->y:I

    iget v4, p0, Lcom/philzhu/www/framework/impl/RButton;->y:I

    add-int/2addr v4, v0

    sub-int/2addr v4, v5

    if-ge v3, v4, :cond_1

    move v3, v5

    .line 169
    :goto_1
    return v3

    .line 159
    .end local v0           #height:I
    .end local v1           #img:Lcom/philzhu/www/framework/Pixmap;
    .end local v2           #width:I
    :cond_0
    iget-object v3, p0, Lcom/philzhu/www/framework/impl/RButton;->btnImgs:[Lcom/philzhu/www/framework/Pixmap;

    aget-object v3, v3, v6

    move-object v1, v3

    goto :goto_0

    .restart local v0       #height:I
    .restart local v1       #img:Lcom/philzhu/www/framework/Pixmap;
    .restart local v2       #width:I
    :cond_1
    move v3, v6

    .line 169
    goto :goto_1
.end method


# virtual methods
.method public drawMe(Lcom/philzhu/www/framework/Graphics;)V
    .locals 4
    .parameter "g"

    .prologue
    const/4 v1, 0x1

    const/4 v3, 0x0

    .line 121
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/RButton;->btnImgs:[Lcom/philzhu/www/framework/Pixmap;

    array-length v0, v0

    if-lez v0, :cond_0

    .line 123
    iget-boolean v0, p0, Lcom/philzhu/www/framework/impl/RButton;->isPressed:Z

    if-eqz v0, :cond_2

    .line 125
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/RButton;->btnImgs:[Lcom/philzhu/www/framework/Pixmap;

    aget-object v0, v0, v1

    if-nez v0, :cond_1

    .line 127
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/RButton;->btnImgs:[Lcom/philzhu/www/framework/Pixmap;

    aget-object v0, v0, v3

    iget v1, p0, Lcom/philzhu/www/framework/impl/RButton;->x:I

    iget v2, p0, Lcom/philzhu/www/framework/impl/RButton;->y:I

    invoke-interface {p1, v0, v1, v2}, Lcom/philzhu/www/framework/Graphics;->drawPixmap(Lcom/philzhu/www/framework/Pixmap;II)V

    .line 138
    :goto_0
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/RButton;->strImgs:Lcom/philzhu/www/framework/Pixmap;

    if-eqz v0, :cond_0

    .line 140
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/RButton;->strImgs:Lcom/philzhu/www/framework/Pixmap;

    iget-object v1, p0, Lcom/philzhu/www/framework/impl/RButton;->btnImgs:[Lcom/philzhu/www/framework/Pixmap;

    aget-object v1, v1, v3

    iget v2, p0, Lcom/philzhu/www/framework/impl/RButton;->x:I

    int-to-float v2, v2

    iget v3, p0, Lcom/philzhu/www/framework/impl/RButton;->y:I

    int-to-float v3, v3

    invoke-interface {p1, v1, v2, v3}, Lcom/philzhu/www/framework/Graphics;->getCenter(Lcom/philzhu/www/framework/Pixmap;FF)Landroid/graphics/Point;

    move-result-object v1

    invoke-interface {p1, v0, v1}, Lcom/philzhu/www/framework/Graphics;->drawPixmapInParentCenter(Lcom/philzhu/www/framework/Pixmap;Landroid/graphics/Point;)V

    .line 143
    :cond_0
    return-void

    .line 131
    :cond_1
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/RButton;->btnImgs:[Lcom/philzhu/www/framework/Pixmap;

    aget-object v0, v0, v1

    iget v1, p0, Lcom/philzhu/www/framework/impl/RButton;->x:I

    iget v2, p0, Lcom/philzhu/www/framework/impl/RButton;->y:I

    invoke-interface {p1, v0, v1, v2}, Lcom/philzhu/www/framework/Graphics;->drawPixmap(Lcom/philzhu/www/framework/Pixmap;II)V

    goto :goto_0

    .line 136
    :cond_2
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/RButton;->btnImgs:[Lcom/philzhu/www/framework/Pixmap;

    aget-object v0, v0, v3

    iget v1, p0, Lcom/philzhu/www/framework/impl/RButton;->x:I

    iget v2, p0, Lcom/philzhu/www/framework/impl/RButton;->y:I

    invoke-interface {p1, v0, v1, v2}, Lcom/philzhu/www/framework/Graphics;->drawPixmap(Lcom/philzhu/www/framework/Pixmap;II)V

    goto :goto_0
.end method

.method public getBtnImgs()[Lcom/philzhu/www/framework/Pixmap;
    .locals 1

    .prologue
    .line 151
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/RButton;->btnImgs:[Lcom/philzhu/www/framework/Pixmap;

    return-object v0
.end method

.method public onTouch(Lcom/philzhu/www/framework/Input$TouchEvent;)Z
    .locals 4
    .parameter "event"

    .prologue
    const/4 v3, 0x0

    const/4 v2, 0x1

    .line 68
    invoke-direct {p0, p1}, Lcom/philzhu/www/framework/impl/RButton;->inBounds(Lcom/philzhu/www/framework/Input$TouchEvent;)Z

    move-result v1

    if-eqz v1, :cond_5

    .line 70
    iget v0, p1, Lcom/philzhu/www/framework/Input$TouchEvent;->type:I

    .line 71
    .local v0, actionType:I
    iget-boolean v1, p0, Lcom/philzhu/www/framework/impl/RButton;->triggerAfterDown:Z

    if-eqz v1, :cond_3

    .line 73
    if-eqz v0, :cond_0

    const/4 v1, 0x2

    if-ne v0, v1, :cond_2

    .line 75
    :cond_0
    iput-boolean v2, p0, Lcom/philzhu/www/framework/impl/RButton;->isPressed:Z

    :cond_1
    :goto_0
    move v1, v2

    .line 110
    .end local v0           #actionType:I
    :goto_1
    return v1

    .line 79
    .restart local v0       #actionType:I
    :cond_2
    if-ne v0, v2, :cond_1

    .line 81
    iget-object v1, p0, Lcom/philzhu/www/framework/impl/RButton;->btnActionListener:Lcom/philzhu/www/framework/ButtonActionListener;

    if-eqz v1, :cond_1

    .line 83
    iput-boolean v3, p0, Lcom/philzhu/www/framework/impl/RButton;->isPressed:Z

    .line 84
    iget-object v1, p0, Lcom/philzhu/www/framework/impl/RButton;->btnActionListener:Lcom/philzhu/www/framework/ButtonActionListener;

    invoke-interface {v1, p0}, Lcom/philzhu/www/framework/ButtonActionListener;->performAction(Lcom/philzhu/www/framework/impl/RButton;)V

    goto :goto_0

    .line 91
    :cond_3
    if-nez v0, :cond_4

    .line 93
    iput-boolean v2, p0, Lcom/philzhu/www/framework/impl/RButton;->isPressed:Z

    .line 94
    iget-object v1, p0, Lcom/philzhu/www/framework/impl/RButton;->btnActionListener:Lcom/philzhu/www/framework/ButtonActionListener;

    if-eqz v1, :cond_1

    .line 96
    iget-object v1, p0, Lcom/philzhu/www/framework/impl/RButton;->btnActionListener:Lcom/philzhu/www/framework/ButtonActionListener;

    invoke-interface {v1, p0}, Lcom/philzhu/www/framework/ButtonActionListener;->performAction(Lcom/philzhu/www/framework/impl/RButton;)V

    goto :goto_0

    .line 99
    :cond_4
    if-ne v0, v2, :cond_1

    .line 101
    iput-boolean v3, p0, Lcom/philzhu/www/framework/impl/RButton;->isPressed:Z

    goto :goto_0

    .line 109
    .end local v0           #actionType:I
    :cond_5
    iput-boolean v3, p0, Lcom/philzhu/www/framework/impl/RButton;->isPressed:Z

    move v1, v3

    .line 110
    goto :goto_1
.end method

.method public setActionListener(Lcom/philzhu/www/framework/ButtonActionListener;)V
    .locals 0
    .parameter "actionListener"

    .prologue
    .line 147
    iput-object p1, p0, Lcom/philzhu/www/framework/impl/RButton;->btnActionListener:Lcom/philzhu/www/framework/ButtonActionListener;

    .line 148
    return-void
.end method

.method public setBtnImgs([Lcom/philzhu/www/framework/Pixmap;)V
    .locals 0
    .parameter "btnImgs"

    .prologue
    .line 155
    iput-object p1, p0, Lcom/philzhu/www/framework/impl/RButton;->btnImgs:[Lcom/philzhu/www/framework/Pixmap;

    .line 156
    return-void
.end method
